model.plot <- model.3.i.p

model.data <- model.frame(model.plot)		


model.data$leader.historical.count <- 2
model.data$first.leader <- 0
model.data$gwf_military <- 1
model.data$gwf_personal <- 0
model.data$gwf_party <- 0

values <- apply(model.data[,c("past.conference.number.noIR","incidence_flag","mad_gdppc","p_polity2","gwf_personal","gwf_party","gwf_military","first.leader","leader.size","leader.time.in.office","leader.historical.count")],2,FUN=mean)
		values <- rbind(values,values,values,values,values,values,values,values,values,values)
				values[,"past.conference.number.noIR"] <- seq(from=min(model.data$past.conference.number.noIR),to=max(model.data$past.conference.number.noIR),length.out=10)

setwd(pathR)
	source('sim_helper.R', chdir = TRUE)


	
		
					data.2$Var2 <- rep(seq(from=min(model.data$past.conference.number.noIR),to=max(model.data$past.conference.number.noIR),length.out=10),each=7)


p1 <- ggplot(data.2[data.2$Var1=="2.5%"|data.2$Var1=="97.5%"|data.2$Var1=="50%",], aes(x=Var2, y=value,fill=as.factor(Var1)))+
    geom_line(aes(linetype=Var1))+scale_linetype_manual(values=c("dashed","solid" ,"dashed"))+xlab("Conference Attendance")+ ylab("Proportion of Groups Included")+ theme_bw()+theme(legend.position="none") 


setwd(pathOUT)
ggsave("IP_NoIR.pdf",p1,width = 9, height = 9, units = c("cm"))


####################  
model.plot <- model.3.i.pop

model.data <- model.frame(model.plot)		

model.data$leader.historical.count <- 2
model.data$first.leader <- 0
model.data$gwf_military <- 1
model.data$gwf_personal <- 0
model.data$gwf_party <- 0


values <- apply(model.data[,c("past.conference.number.noIR","incidence_flag","mad_gdppc","p_polity2","gwf_personal","gwf_party","gwf_military","first.leader","leader.size","leader.time.in.office","leader.historical.count")],2,FUN=mean)
		values <- rbind(values,values,values,values,values,values,values,values,values,values)
				values[,"past.conference.number.noIR"] <- seq(from=min(model.data$past.conference.number.noIR),to=max(model.data$past.conference.number.noIR),length.out=10)


setwd(pathR)
	source('sim_helper.R', chdir = TRUE)


	
		
					data.2$Var2 <- rep(seq(from=min(model.data$past.conference.number.noIR),to=max(model.data$past.conference.number.noIR),length.out=10),each=7)


p1 <- ggplot(data.2[data.2$Var1=="2.5%"|data.2$Var1=="97.5%"|data.2$Var1=="50%",], aes(x=Var2, y=value,fill=as.factor(Var1)))+
    geom_line(aes(linetype=Var1))+scale_linetype_manual(values=c("dashed","solid" ,"dashed"))+xlab("Conference Attendance")+ ylab("Proportion of Population Included")+ theme_bw() + theme(legend.position="none")


setwd(pathOUT)
ggsave("IPop_NoIR.pdf",p1,width = 9, height = 9, units = c("cm"))







